package com.yanqu.road.server.logic.activity.condition.normal;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.task.args.UnionRiseRankArgs;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;
import com.yanqu.road.server.logic.activity.common.BaseGeneralUnionRankCondition;
import com.yanqu.road.server.manger.activity.GeneralActivityRankMgr;

public class BowArtActivityUnionScoreRankCondition extends BaseGeneralUnionRankCondition {


    public BowArtActivityUnionScoreRankCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData) {
        super(activityInfo, activityConditionInfo, baseActivityData);
    }

    @Override
    public void addTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.BowArtActivityUnionScoreRank.getValue(), handle);
    }

    @Override
    public void removeTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().removeListener(eGamePlayerEventType.BowArtActivityUnionScoreRank.getValue(), handle);
    }

    @Override
    protected void player_BoardLevelHandle(Object object) {
        UnionRiseRankArgs args = (UnionRiseRankArgs) object;
        if (null != args) {
            if (UnionRiseRankArgs.NOTIFY_TYPE_DELETE == args.getType()) {//解散商会
                GeneralActivityRankMgr.removeUnionActivityRank(activityInfo.getActivityId(), activityConditionInfo.getType(), args.getUnionUid(), player.getUserId());
            } else {
                setUnionRankActivityValue(args.getValue(), args.getUnionUid(), args.getType());
            }
        }
    }
}
